package com.medicine.lungs.controller;

import com.medicine.lungs.service.LungsCtService;
import com.medicine.pojo.Patient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @author SongMin
 * @date 2021/6/1
 */

@RestController
@Api(value = "LungsCtController", tags = "肺部CT影像信息的接口")
@RequestMapping("/lungs")
public class LungsCtController {

    @Autowired
    private LungsCtService lungsCtService;
    @ApiOperation(value = "显示患者详情", notes = "显示患者有关肺部的详细信息")
    @PostMapping("/info")
    @ResponseBody
    public Patient queryLungsInfo(){
        return lungsCtService.queryLungsInfo();
    }

    @ApiOperation(value = "查询患者肺部详情", notes = "按照肺部影像图ID查询患者肺部详情")
    @ApiImplicitParam(name = "map", value = "封装到map中的患者ID")
    @PostMapping("/lungsInfo")
    @ResponseBody
    public List<Map<String, Object>> queryLungsInfoByCtId(@RequestBody Map<String,Integer> map){
        return lungsCtService.queryLungsInfoByCtId(map.get("CtId"));
    }
    @ApiOperation(value = "查询患者详情", notes = "按照ID查询患者有关肺部的详细信息")
    @ApiImplicitParam(name = "map", value = "封装到map中的患者ID")
    @PostMapping("/id")
    public Patient queryInfoById(@RequestBody Map<String,Integer> map){
        return lungsCtService.queryLungsInfoById(map.get("id"));
    }
    @ApiOperation(value = "查询患者详情", notes = "按照Name查询患者有关肺部的详细信息")
    @ApiImplicitParam(name = "map", value = "封装到map中的患者Name")
    @PostMapping("/name")
    public List<Patient> queryInfoByName(@RequestBody Map<String,String> map){
        return lungsCtService.queryLungsInfoByName(map.get("name"));
    }
    @ApiOperation(value = "显示异常图序列号", notes = "显示患者肺部异常图序列号")
    @PostMapping("/firstExcep")
    public List ExceptionList(@RequestBody Map<String,Integer> map){
        return lungsCtService.ExceptionId();
    }

    @ApiOperation(value = "查询异常图序列号", notes = "按照ID查询患者肺部异常图序列号")
    @ApiImplicitParam(name = "map", value = "封装到map中的患者ID")
    @PostMapping("/excep")
    public List ExceptionListById(@RequestBody Map<String,Integer> map){
        return lungsCtService.ExceptionId(map.get("id"));
    }

    @ApiOperation(value = "查询标记点信息", notes = "按照ID查询标记点信息")
    @ApiImplicitParam(name = "map", value = "封装到map中的患者ID")
    @PostMapping("/LableId")
    public Map<String, Object> queryLabelInfoById(@RequestBody Map<String,Integer> map){
        return lungsCtService.queryLabelInfoById(map.get("id"));
    }
    @ApiOperation(value = "查询检查结果", notes = "按照ID查询检查结果")
    @ApiImplicitParam(name = "map", value = "封装到map中的患者ID")
    @PostMapping("/pid")
    public List<Map<String, Object>> queryResultsById(@RequestBody Map<String,Integer> map){
        return lungsCtService.queryResultsById(map.get("id"));
    }
    @ApiOperation(value = "显示检查结果", notes = "显示肺部检查结果")
    @PostMapping("/resultInfo")
    public List<Map<String, Object>> queryResults(){
        return lungsCtService.queryResults();
    }
}
